//
//  TPDetailFooter.m
//  Yimei
//
//  Created by xiaowu xiaowu on 2017/10/25.
//  Copyright © 2017年 xiaowu xiaowu. All rights reserved.
//

#import "TPDetailFooter.h"

@implementation TPDetailFooter

-(instancetype)init{
    if(self = [super init]){
        [self setup];
    }
    return self;
}
-(void )setup{
    
        self.backgroundColor = [UIColor whiteColor];
    
    
        UIButton *resetButton = [UIButton buttonWithFrame:CGRectZero title:@"在线咨询" font:fontSystemOfSize(17) color:TPAllBackgroundColor];
        [resetButton setImage:ImageNamed(@"TP_detail_customer_icon") forState:UIControlStateNormal];
        resetButton.imageEdgeInsets = UIEdgeInsetsMake(0, 0, 0, 5);
        [self addSubview:resetButton];
        resetButton.tag = 111;
        [resetButton addTouchUpInsideTarget:self action:@selector(actionClick:)];
        
        UIButton *doneButton = [UIButton buttonWithFrame:CGRectZero title:@"立即预定" font:fontSystemOfSize(17) color:[UIColor whiteColor]];
        [doneButton setBackgroundImageColor:TPAllBackgroundColor forState:UIControlStateNormal];
        doneButton.tag = 222;
        [self addSubview:doneButton];
        [doneButton addTouchUpInsideTarget:self action:@selector(actionClick:)];
        
        [resetButton mas_makeConstraints:^(MASConstraintMaker *make) {
            make.left.top.bottom.mas_equalTo(0.0);
            make.width.mas_equalTo(self.mas_width).multipliedBy(0.5);
        }];
        [doneButton mas_makeConstraints:^(MASConstraintMaker *make) {
            make.right.top.bottom.mas_equalTo(0.0);
            make.width.mas_equalTo(resetButton.mas_width);
        }];
        [self tp_addLineTopWithColor:TPAllBackgroundColor];
        
  
}
-(void)actionClick:(UIButton *)button{
    if(self.didClickBlock){
        self.didClickBlock(button);
    }
}
@end
